Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 10, 2026

Authentication middleware logs every request attempt to console, creating excessive noise during bulk uploads and crawler traffic. This adds a configuration flag to control auth logging verbosity.

Changes

Configuration

  • Added AuthVerbose bool field to Options struct (default: false)
  • Environment variable: SERVICE_AUTH_VERBOSE
  • Command-line flag: --auth-verbose

Implementation

  • Updated all auth middleware functions (EmbAPIKeyAdminAuth, EmbAPIKeyOwnerAuth, EmbAPIKeyReaderAuth, EmbAPIKeyEditorAuth, AuthTermination) to accept *models.Options parameter
  • Wrapped 18 authentication log statements with conditional checks: if options.AuthVerbose { fmt.Print(...) }
  • Handler functions (handleProjectReaderAuth, handleDefinitionReaderAuth, etc.) now pass options parameter

Documentation

  • Updated template.env, configuration guides, and environment variable reference
  • Included usage examples for development (verbose) and production (quiet) scenarios

Example

# Production: quiet by default
SERVICE_AUTH_VERBOSE=false  # No auth logs
SERVICE_DEBUG=false

# Development: verbose for debugging
SERVICE_AUTH_VERBOSE=true   # Logs all auth attempts
SERVICE_DEBUG=true

Before (always logs):

    Owner authentication successful: sal
    Reader auth for owner=bob project=test...
    Authentication failed.

After (logs only when SERVICE_AUTH_VERBOSE=true).

Backward Compatibility

Default is false (quiet mode), providing cleaner logs for existing deployments without configuration changes.

Original prompt

This repository implements a middleware RESTful API for a vector database. When requests come in, the process logs in the console information like

       Owner authentication successful: sal
Found project gemini-simil ...        Owner authentication successful: sal
        Authentication failed.

(also note the weird whitespace and linebreak pattern)
If there are bulk uploads going on (or if a crawler hammers the server), all the successful and failed authentication messages become a bit too much. What would you suggest to do about this? (A verbose commandline switch/configuration would be a good starting point, but I wonder if there are things to keep in mind when going this way...) Please provide an assessment of the available implementation options, and offer to implement one or two of them.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits February 10, 2026 21:35
Co-authored-by: awagner-mainz <2088443+awagner-mainz@users.noreply.github.com>
Co-authored-by: awagner-mainz <2088443+awagner-mainz@users.noreply.github.com>
Co-authored-by: awagner-mainz <2088443+awagner-mainz@users.noreply.github.com>
Co-authored-by: awagner-mainz <2088443+awagner-mainz@users.noreply.github.com>
Copilot AI changed the title [WIP] Add verbose logging option to middleware API Add configurable authentication logging via SERVICE_AUTH_VERBOSE flag Feb 10, 2026
Copilot AI requested a review from awagner-mainz February 10, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants